home *** CD-ROM | disk | FTP | other *** search
/ Family Forum 262 / SOMC Family Forum 262.iso / Xtras / Animation Wizard.dir / 00002_Utility routines.ls < prev    next >
Encoding:
Text File  |  1997-05-10  |  2.5 KB  |  103 lines

  1. on wait nTicks
  2.   set endTime to the ticks + nTicks
  3.   repeat while the ticks < endTime
  4.   end repeat
  5. end
  6.  
  7. on PressButton
  8.   set chButton to the clickOn
  9.   set castNumButtonUp to the castNum of sprite chButton
  10.   set btnUpName to the name of cast castNumButtonUp
  11.   set nWordsInName to the number of words in btnUpName
  12.   if nWordsInName > 1 then
  13.     if word 2 of btnUpName = "Gray" then
  14.       return 0
  15.     end if
  16.   end if
  17.   if nWordsInName = 1 then
  18.     set castNumButtonDown to castNumButtonUp + 1
  19.   else
  20.     set castNumBase to the number of member word 1 of btnUpName
  21.     set castNumButtonDown to castNumBase + 1
  22.   end if
  23.   set downFlag to 1
  24.   repeat while downFlag
  25.     if rollOver(chButton) then
  26.       set the castNum of sprite chButton to castNumButtonDown
  27.     else
  28.       set the castNum of sprite chButton to castNumButtonUp
  29.     end if
  30.     updateStage()
  31.     set downFlag to the stillDown
  32.   end repeat
  33.   set the castNum of sprite chButton to castNumButtonUp
  34.   updateStage()
  35.   if rollOver(chButton) then
  36.     return 1
  37.   else
  38.     set the castNum of sprite chButton to castNumButtonUp
  39.     return 0
  40.   end if
  41. end
  42.  
  43. on PressCheckBox
  44.   set chCheckBox to the clickOn
  45.   set castNumCheckBoxUp to the castNum of sprite chCheckBox
  46.   set checkBoxUpName to the name of cast castNumCheckBoxUp
  47.   set nWordsInName to the number of words in checkBoxUpName
  48.   if nWordsInName > 1 then
  49.     if word 2 of checkBoxUpName = "Gray" then
  50.       return 0
  51.     end if
  52.   end if
  53.   set castNumCheckBoxDown to castNumCheckBoxUp + 1
  54.   set downFlag to 1
  55.   repeat while downFlag
  56.     if rollOver(chCheckBox) then
  57.       set the castNum of sprite chCheckBox to castNumCheckBoxDown
  58.     else
  59.       set the castNum of sprite chCheckBox to castNumCheckBoxUp
  60.     end if
  61.     updateStage()
  62.     set downFlag to the stillDown
  63.   end repeat
  64.   if rollOver(chCheckBox) then
  65.     return 1
  66.   else
  67.     set the castNum of sprite chCheckBox to castNumCheckBoxUp
  68.     return 0
  69.   end if
  70. end
  71.  
  72. on IncrMod theCurrentValue, theMaxValue
  73.   if theCurrentValue = theMaxValue then
  74.     return 1
  75.   else
  76.     return theCurrentValue + 1
  77.   end if
  78. end
  79.  
  80. on DecrMod theCurrentValue, theMaxValue
  81.   if theCurrentValue = 1 then
  82.     return theMaxValue
  83.   else
  84.     return theCurrentValue - 1
  85.   end if
  86. end
  87.  
  88. on HitWhoH spriteNum, theMax
  89.   set theRealWidth to the right of sprite spriteNum - the left of sprite spriteNum
  90.   set who to ((the mouseH - the left of sprite spriteNum) * theMax / theRealWidth) + 1
  91.   if who <= 1 then
  92.     set who to 1
  93.   end if
  94.   if who > theMax then
  95.     set who to theMax
  96.   end if
  97.   return who
  98. end
  99.  
  100. on round n
  101.   return integer(n + 0.49000000000000005)
  102. end
  103.